//
//  UIBarButton+Extension.swift
//  
//
//  Created by Apple on 15/11/26.
//
//

import UIKit

extension UIBarButtonItem{
    convenience init(imageName: String) {
        let button = UIButton()
        button.setBackgroundImage(UIImage(named: imageName), forState: UIControlState.Normal)
        button.setBackgroundImage(UIImage(named: "\(imageName)_highlighted"), forState: UIControlState.Highlighted)
        
        button.sizeToFit()
        // 调用本类自定义的构造函数
        self.init(customView:button)
        
    }

}
